home *** CD-ROM | disk | FTP | other *** search
- // ******************* File: prog6.C *****************
- // Using Interpolation function in ParametricTPSurface
- #include <ParametricTPSurface.h>
- #include <splineOutput.h>
-
- int main()
- {
- const real Pi=M_PI; // M_PI is found in math.h (3.14159....)
- // generate points on a surface:
- Mat(real) xm(29,5), ym(29,5), zm(29,5); // (xm,ym,zm) coord. of a point
- real theta, phi;
- for (int i=1; i<=29; i++)
- {
- theta=(i-1)*Pi/8;
- for (int j=1; j<=5; j++)
- {
- phi=(j+3)*Pi/4;
- xm(i,j)=(800-(i-1)*25+200*cos(phi))*cos(theta)+1000;
- ym(i,j)=(800-(i-1)*25+200*cos(phi))*sin(theta)+1000;
- zm(i,j)=200*sin(phi)+200;
- }
- }
- ParametricTPSurface ptps;
- ptps.interpolation(xm,ym,zm,4,4,"Uniform","Uniform");
- createMathFile(ptps,1,1,"FILE=surface3.math");
- return 0;
- }
-